package com.yunshang.ysmall.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yunshang.ysmall.mapper.OrderInfoMapper;
import com.yunshang.ysmall.mapper.OrderItemInfoMapper;
import com.yunshang.ysmall.mapper.ReturnFanchangInfoMapper;
import com.yunshang.ysmall.model.OrderInfo;
import com.yunshang.ysmall.model.OrderItemInfo;
import com.yunshang.ysmall.model.ReturnFanchang;
import com.yunshang.ysmall.service.SalesReturnService;

@Service
public class SalesReturnServiceImpl implements SalesReturnService {
		@Resource
		ReturnFanchangInfoMapper returnFanchangInfoMapper;
		@Resource
		OrderItemInfoMapper orderItemInfoMapper;
		@Resource
		OrderInfoMapper   orderInfoMapper;

		@Override
		public List<ReturnFanchang> findSalesReturnAll(String memberId) {
			return returnFanchangInfoMapper.findReturnFanchangInfoAll(memberId);
		}

		@Override
		public OrderInfo findOrderItemInfo(String orderId) {
				OrderInfo orderInfo=orderInfoMapper.selectByOrderId(orderId);
				List<OrderItemInfo> orderItemInfos=orderItemInfoMapper.getItemListByOrderId(orderId);
				orderInfo.setItemList(orderItemInfos);
			return orderInfo;
		}

		@Override
		public List<ReturnFanchang> getSalesReturnList(Map<String,Object> parameter){
					return returnFanchangInfoMapper.findSalesReturnList(parameter);
		}

		@Override
		public List<ReturnFanchang> pedingSalesReturnList(
				Map<String, Object> parameter) {
			return returnFanchangInfoMapper.findpendingSalesReturnList(parameter);
		}

		@Override
		public void updateSalesReturn(String orderId) {
			returnFanchangInfoMapper.updateSalesReturnStuats(orderId);
		}

		@Override
		public List<ReturnFanchang> findendSalesReturnAll(Map<String,Object> parameter) {
			return returnFanchangInfoMapper.findProcessedSalesReturnOrderAll(parameter);
		}

		@Override
		public void updateOrderInfoStatus(String orderId) {
			orderInfoMapper.updateOrderInfoByOrderId(orderId);
			
		}

		@Override
		public OrderInfo findOrderInfo(String orderId) {
			return orderInfoMapper.findByOrderId(orderId);
		}

		@Override
		public List<OrderItemInfo> findProductAll(String orderId) {
			return orderItemInfoMapper.getItemListByOrderId(orderId);
		}

		@Override
		public ReturnFanchang findSalesReturnOrderId(String orderId) {
			return returnFanchangInfoMapper.findSalesReturnByOrderId(orderId);
		}

		@Override
		public OrderInfo selectOrderId(String orderId) {
			return orderInfoMapper.selectByOrderId(orderId);
		}

		@Override
		public void updateSalesReturnTrackingNumber(
				ReturnFanchang returnFanchang) {
			this.returnFanchangInfoMapper.updateSalesReturnByTrackingNumber(returnFanchang);			
		}


}
